Here is some data (time, voltage) from a Cavendish Balance

data2=Import["/Users/darrelsmith/Documents/ERAU/Web Stuff/Darrel Home Page folder/Darrel Home Page/Courses/CoursesS2023/PS315/Data Analysis/Michael Fusco/ClockwiseCavendish4.csv","CSV"];

data=Drop[data2,1]

Length[data]

ListPlot[Take[data,{1050,1100}]]

gr1 = ListPlot[data,PlotStyle->{PointSize[0.002]}]

Show[gr1,ImageSize->Tiny]

Fit to a damped cosine wave

ff = FindFit[data,amp (E^(-γ t)) Cos[((2 π)/per) t+ϕ] +const,{{amp,-10},{const,-30.},{γ,1./2020.},{per, 240.},{ϕ,-2.}},t]

f[t_]:=amp (E^(-γ t)) Cos[((2 π)/per) t+ϕ] +const/.ff

gr2 = Plot[f[t],{t,0.,1100.}]

Show[{gr1,gr2}]

Calculate the (χ^2)

chisqmin=(∑_(i=1)^(Length[data]))(1/(((0.003))^2))(((data[[i,2]]-(amp (E^(-γ data[[i,1]])) Cos[((2 π)/per) data[[i,1]]+ϕ] +const/.ff)))^2)

chisq[constant_]=(∑_(i=1)^(Length[data]))(1/(((0.003))^2))(((data[[i,2]]-(amp (E^(-γ data[[i,1]])) Cos[((2 π)/per) data[[i,1]]+ϕ] +constant/.ff)))^2);

Find the uncertainty in the period

Plot[chisq[constant],{constant,-26.,-27.}]

fcon=FindRoot[chisq[constant]==chisqmin+1.,{constant,const/.ff}]
errorCon=Abs[(constant/.fcon)-const/.ff]

Print["constant = ",const/.ff  ," +/- ", errorCon];

FindMinimum[ (Underoverscript[ ∑, (i=1), (Length[data])])(((data[[i,2]]-(amp (E^(-γ data[[i,1]])) Cos[((2 π)/per) data[[i,1]]+ϕ] +const)))^2),{{amp,-10},{const,-30.},{γ,1./2020.},{per, 240.},{ϕ,-2.}}]